/**
 * 
 */
package org.dg.iag.server;

import org.dg.iag.dao.GenericDAO;
import org.dg.iag.entity.Settings;
import org.dg.iag.entity.SettingsInstance;
import org.dg.iag.interf.entity.GenericRestResource;
import org.dg.iag.util.ApplicationConstants;
import org.dg.iag.util.LoginUtil;
import org.restlet.resource.ServerResource;

/**
 * @author Alex Gartner
 *
 */
public class SettingsServerResource extends ServerResource 
						implements GenericRestResource<Settings>{

	@Override
	public Settings getElement() {
		if ( ! LoginUtil.checkLogin(getRequest()) ) 
			return null;
		GenericDAO<SettingsInstance, Settings> gdao 	= 
				new GenericDAO<SettingsInstance, Settings>(ApplicationConstants.SETTINGS_XML);
		Settings settings	= gdao.getElements(SettingsResource.class);
		
		return settings;
	}

	@Override
	public void addElement(Settings element) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public Object modifyElement(Settings element) {
		// TODO Auto-generated method stub
		return null;
	}

	public interface SettingsResource extends GenericRestResource<Settings> {}
}
